<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body >
	<h1>
		<h:link outcome="home" value="TravelDream" />
	</h1>
	<p:layout style="min-width:400px;min-height:200px;" id="layout" >
		
		<p:layoutUnit position="west" resizable="true" size="100" minSize="40"
			maxSize="200">
			<h4>Accedi</h4>
			<h:link outcome="pagine_impiegati/index.xhtml"
				value="Impiegato" />
			<br />
			<h:link outcome="pagine_clienti/index.xhtml?user=true"
				value="Cliente" />
		</p:layoutUnit>

		<p:layoutUnit position="center">
        Benvenuto su TravelDream!
   <h:form id="form">  
   
    <p:inputMask value="#{pacchettoBean.ric}"/> 
	<p:commandButton icon="ui-icon-search" value="Cerca per Città" action="#{pacchettoBean.ricercaCitta()}" update="form"/> 
	<p:commandButton icon="ui-icon-search" value="Cerca per Nome" action="#{pacchettoBean.ricercaNome()}" update="form"/>
              
    <p:dataList value="#{pacchettoBean.pacchetti}" var="packDTO"  
        paginator="true" rows="5"  
        paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"  
        rowsPerPageTemplate="5,10,15" type="none">  
  
            <f:facet name="header">  
                Elenco pacchetti  
            </f:facet>  
  
            <p:commandButton icon="ui-icon-search" update=":form:packDetail" oncomplete="PF('packDialog').show()" title="Vedi Dettagli">  
                <f:setPropertyActionListener value="#{packDTO}" target="#{pacchettoBean.selectPack}" />  
            </p:commandButton>  
			
			
			
  			<h:outputText value="#{packDTO.nome}, #{packDTO.luogo}, #{packDTO.prezzo} €" style="margin-left:10px" /> 
            
            <br />  
    </p:dataList>  
    
    <p:dialog header="Pack Detail" widgetVar="packDialog" modal="false" showEffect="fade">  
        <p:outputPanel id="packDetail" style="text-align:center;" layout="block">  
          
             
            <h:panelGrid  columns="2" cellpadding="5">  
                <h:outputLabel for="nome" value="Nome Pacchetto: " />  
                <h:outputText id="nome" value="#{pacchettoBean.selectedPack.nome}" />  
                  
                <h:outputLabel for="postiDisponibili" value="Posti disponibili: " />  
                <h:outputText id="postiDisponibili" value="#{pacchettoBean.selectedPack.numeroPosti}" />  
                  
                <h:outputLabel for="prezzo" value="Prezzo: " />  
                <h:outputText id="prezzo" value="#{pacchettoBean.selectedPack.prezzo}"/> 
                
                <h:outputLabel for="dataPartenza" value="Data Partenza: "/>
                <h:outputText id="dataPartenza" value="#{pacchettoBean.selectedPack.dataPartenza}">
                	<f:convertDateTime  type="date" /> 
                </h:outputText>
                
            </h:panelGrid>  
        </p:outputPanel>  
    </p:dialog>  
  
</h:form>  
        
        </p:layoutUnit>
	</p:layout>
	

</h:body>
</html>